// Copyright (c) 2007 Robin Boerdijk. All rights reserved.
//
// This software is licensed under the terms of the Microsoft Reciprocal License as described 
// in the file LICENSE.txt, which you should have received as part of this distribution. The 
// license terms are also available at http://www.opensource.org/licenses/ms-rl.html.

#ifndef wtk_ContentBox_h_included
#define wtk_ContentBox_h_included

#include "wtk/Box.h"

namespace wtk
{
	class ContentBox : public Box
	{
	public:

		ContentBox();

		void SetMargin(const RECT &margin);

		void SetMargin(long left, long top, long right, long bottom);

		void SetMargin(long leftRight, long topBottom);

		void SetMargin(long margin);

		virtual SIZE GetMinimumSize();

		virtual long GetHorizontalElasticity();

		virtual long GetVerticalElasticity();

		virtual void Layout(const SIZE &size, const POINT &position = Zero<POINT>());

	protected:

		virtual SIZE CalculateMinimumContentSize() = 0;

		virtual long CalculateHorizontalElasticity() = 0;

		virtual long CalculateVerticalElasticity() = 0;

		virtual void LayoutContent(const POINT &position, const SIZE &size) = 0;

	private:

		RECT m_margin;

		SIZE m_cachedMinimumSize;

		long m_cachedHorizontalElasticity;

		long m_cachedVerticalElasticity;
	};
}

#endif